import java.util.Scanner;

public class test6 {
    //求斐波那契数列的第n项。(迭代实现)
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入数字:");
        int n = sc.nextInt();
        int n1 = fibonacci(n);
        System.out.println("斐波那契数列的第"+n+"项为:"+n1);
    }
    public static int fibonacci(int n){
        if(n<=2){
            return 1;
        }else {
            return fibonacci(n-1)+fibonacci(n-2);
        }
    }
}
